#ifndef __SCA_ARM_MSG_H__
#define __SCA_ARM_MSG_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include "stdint.h"
#include "drv_mrc.h"
#pragma pack(1)
    typedef struct Simplified_Joint_CMD_MSG
    {
        uint8_t id; // 1 bytes
        // float des_pos;   // 4 bytes
        int32_t des_pos; // 4 bytes
        int16_t des_vel; // 2 bytes
        int16_t des_tor; // 2 bytes
        uint16_t des_kp; // 2 bytes
        uint16_t des_kd; // 2 bytes

    } Simplified_Joint_CMD_MSG; // 13 bytes
#pragma pack()

#pragma pack(1)
    typedef struct Simplified_Joint_States_MSG
    {
        uint8_t id; // 1 bytes
        // float actual_pos;   // 4 bytes
        int32_t actual_pos; // 4 bytes
        int16_t actual_vel; // 2 bytes
        int16_t actual_tor; // 2 bytes

    } Simplified_Joint_States_MSG; // 9 bytes
#pragma pack()

#pragma pack(1)
    typedef struct SCA_ARM_CMD_MSG
    {
        uint8_t head[2];                       // 2 bytes
        uint8_t mode;                          // 1 bytes 0x00 init mode, 0x01 position control mode
        Simplified_Joint_CMD_MSG joint_cmd[3]; // 39 bytes
        int16_t MRC_voltage[2];                // 4 bytes
        uint16_t CRC16Data;                    // 2 bytes
    } SCA_ARM_CMD_MSG;                         // 48 bytes
#pragma pack()

#pragma pack(1)
    typedef struct SCA_ARM_FBK_MSG
    {
        uint8_t head[2];                             // 2 bytes
        uint8_t mode;                                // 1 bytes 0x00 init mode, 0x01 position control mode
        Simplified_Joint_States_MSG joint_states[3]; // 27 bytes
        int16_t MRC_voltage[2];                      // 4 bytes
        // float SA100_angle;                           // 4 bytes
        int32_t SA100_angle; // 4 bytes
        uint16_t CRC16Data;  // 2 bytes
    } SCA_ARM_FBK_MSG;       // 40 bytes
#pragma pack()

#ifdef __cplusplus
}
#endif

#endif //__SCA_ARM_MSG_H__
